const {defineConfig} = require('@vue/cli-service')
module.exports = defineConfig({
    publicPath: '/xls/',
    outputDir: 'xlsProductionSystem',
    assetsDir: 'static',
    productionSourceMap: false,
    transpileDependencies: true,

    chainWebpack: config => {
        config.plugin('html').tap(args => {
            args[0].title = '生产系统'
            return args
        })
        config.plugin('define').tap(args => {
            const date = new Date()
            const y = date.getFullYear()
            const m = String(date.getMonth() + 1).padStart(2, '0')
            const d = String(date.getDate()).padStart(2, '0')
            const h = String(date.getHours()).padStart(2, '0')
            const i = String(date.getMinutes()).padStart(2, '0')
            args[0]['process.env'].version = JSON.stringify(`${y}${m}${d}${h}${i}`)
            return args
        })
    },
    devServer: {
        hot: true,
        open: true,
        client: {
            overlay: false
        },
        historyApiFallback: {
            index: '/index.html'
        },
        proxy: {
            '/api': {
                // target: 'https://zs.xinlvyao.com/api',
                target: 'http://192.168.31.48:19818',
                changeOrigin: true,
                pathRewrite: {
                    '^/api': ''
                }
            },
        }
    },
})
